import { useSortable } from '@dnd-kit/sortable';
import { ILCComponentConfig, ILCJsonContext } from '../interface/ILCInterface';
import { CSS } from '@dnd-kit/utilities';
import React from 'react';

interface IFormItemWrapProps extends ILCJsonContext {
}

const FormItemWrap: React.FC<IFormItemWrapProps> = (props) => {
    const {
        attributes,
        listeners,
        setNodeRef,
        transform,
        transition,
    } = useSortable({ id: props.props.name });

    const style = {
        transform: CSS.Transform.toString(transform),
        transition,
    };
    return (
        <div ref={setNodeRef} style={style} {...attributes} {...listeners}>
            {props.children}
        </div>
    )
}

export default FormItemWrap;